package com.ankiang.treeprint.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.regex.Pattern;

public class TRRelationShip {


    //简写
    JSONArray _filter;

    //关系数据
    //语法说明：
    //【关系】f:父,m:母,h:夫,w:妻,s:子,d:女,xb:兄弟,ob:兄,lb:弟,xs:姐妹,os:姐,ls:妹
    //【修饰符】 1:男性,0:女性,&o:年长,&l:年幼,#:隔断,[a|b]:并列
    JSONObject _data;

    private void addData(String a, String[] b) {
        addToJson(this._data, a, b);

//        JSONArray arr = new JSONArray();
//        for (int i = 0; i < b.length; i++) {
//            arr.add(b[i]);
//        }
//        this._data.put(a, b);
    }

    public void initData() {
        this._data = new JSONObject();

        addData("", new String[]{"自己", "我"});
        //并称
        addData("[f|m]", new String[]{"父母", "爹娘", "爹妈", "爸妈", "双亲", "二老", "高堂"});
        addData("[h,f|h,m]", new String[]{"公婆"});
        addData("[xb|xs]", new String[]{"兄弟姐妹"});
        addData("[s|d]", new String[]{"子女", "儿女", "小孩", "孩子"});
        //本家
        addData("f", new String[]{"爸爸", "父亲", "阿爸", "老爸", "老窦", "爸", "爹", "爹爹", "爹地", "爹啲", "老爹", "大大", "老爷子", "老头子", "父"});
        addData("f,f", new String[]{"爷爷", "祖父", "阿爷", "奶爷", "阿公", "老爷"});
        addData("f,f,f", new String[]{"曾祖父", "太爷", "太爷爷", "太公", "祖公", "祖奶爷", "太老爷"});
        addData("f,f,f,f", new String[]{"高祖父", "老太爷", "祖太爷", "祖太爷爷", "祖太公"});
        addData("f,f,f,f,f", new String[]{"天祖父"});
        addData("f,f,f,f,f,f", new String[]{"烈祖父"});
        addData("f,f,f,f,f,m", new String[]{"烈祖母"});
        addData("f,f,f,f,f,f,f", new String[]{"太祖父"});
        addData("f,f,f,f,f,f,m", new String[]{"太祖母"});
        addData("f,f,f,f,f,f,f,f", new String[]{"远祖父"});
        addData("f,f,f,f,f,f,f,m", new String[]{"远祖母"});
        addData("f,f,f,f,f,f,f,f,f", new String[]{"鼻祖父"});
        addData("f,f,f,f,f,f,f,f,m", new String[]{"鼻祖母"});
        addData("f,f,f,f,m", new String[]{"天祖母"});
        addData("f,f,f,f,ob", new String[]{"伯高祖父"});
        addData("f,f,f,f,ob,w", new String[]{"伯高祖母"});
        addData("f,f,f,f,lb", new String[]{"叔高祖父"});
        addData("f,f,f,f,lb,w", new String[]{"叔高祖母"});
        addData("f,f,f,f,xs", new String[]{"姑高祖母"});
        addData("f,f,f,f,xs,h", new String[]{"姑高祖父"});
        addData("f,f,f,m", new String[]{"高祖母", "老太太", "祖太太", "祖太奶", "祖太奶奶", "祖太婆"});
        addData("f,f,f,m,xs", new String[]{"姨高祖母"});
        addData("f,f,f,m,xs,h", new String[]{"姨高祖父"});
        addData("f,f,f,m,xb", new String[]{"舅高祖父"});
        addData("f,f,f,m,xb,w", new String[]{"舅高祖母"});
        addData("f,f,f,ob", new String[]{"曾伯祖父", "曾伯父", "伯曾祖父", "伯公太", "伯太爷", "伯公老爷"});
        addData("f,f,f,ob,w", new String[]{"曾伯祖母", "曾伯母", "伯曾祖母", "伯婆太", "伯太太", "伯婆奶奶"});
        addData("f,f,f,lb", new String[]{"曾叔祖父", "曾叔父", "叔曾祖父", "叔公太", "叔太爷", "叔公老爷"});
        addData("f,f,f,lb,w", new String[]{"曾叔祖母", "曾叔母", "叔曾祖母", "叔婆太", "叔太太", "叔婆奶奶"});
        addData("f,f,f,xb,s&o", new String[]{"堂伯祖父", "族伯祖父"});
        addData("f,f,f,xb,s&o,w", new String[]{"堂伯祖母", "族伯祖母"});
        addData("f,f,f,xb,s&l", new String[]{"堂叔祖父", "族叔祖父"});
        addData("f,f,f,xb,s&l,w", new String[]{"堂叔祖母", "族叔祖母"});
        addData("f,f,f,xb,s,s&o", new String[]{"从伯父", "族伯父"});
        addData("f,f,f,xb,s,s&o,w", new String[]{"从伯母", "族伯母"});
        addData("f,f,f,xb,s,s&l", new String[]{"从叔父", "族叔父"});
        addData("f,f,f,xb,s,s&l,w", new String[]{"从叔母", "族叔母"});
        addData("f,f,f,xb,s,s,s&o", new String[]{"族兄"});
        addData("f,f,f,xb,s,s,s&l", new String[]{"族弟"});
        addData("f,f,f,xb,d", new String[]{"堂姑祖母"});
        addData("f,f,f,xb,d,h", new String[]{"堂姑祖父"});
        addData("f,f,f,xs", new String[]{"曾祖姑母", "姑曾祖母", "太姑婆", "姑婆太", "姑太太", "曾祖姑", "姑婆奶奶"});
        addData("f,f,f,xs,h", new String[]{"曾祖姑丈", "姑曾祖父", "太姑丈公", "姑丈公太", "姑太爷", "姑公老爷"});
        addData("f,f,f,xs,s&o", new String[]{"表伯祖父"});
        addData("f,f,f,xs,s&o,w", new String[]{"表伯祖母"});
        addData("f,f,f,xs,s&l", new String[]{"表叔祖父"});
        addData("f,f,f,xs,s&l,w", new String[]{"表叔祖母"});
        addData("f,f,f,xs,d", new String[]{"表姑祖母", "族祖姑"});
        addData("f,f,f,xs,d,h", new String[]{"表姑祖父"});
        addData("f,f,m", new String[]{"曾祖母", "太奶奶", "太婆", "祖婆", "祖奶奶"});
        addData("f,f,m,f", new String[]{"高外祖父", "祖太姥爷", "祖太公"});
        addData("f,f,m,m", new String[]{"高外祖母", "祖太姥姥", "祖太姥娘", "祖太婆"});
        addData("f,f,m,xb", new String[]{"舅曾祖父", "太舅公", "太舅爷", "舅太爷", "舅太爷爷", "舅公老爷"});
        addData("f,f,m,xb,w", new String[]{"舅曾祖母", "太舅婆", "舅太太", "舅太奶奶", "舅婆奶奶"});
        addData("f,f,m,xb,s&o", new String[]{"表伯祖父"});
        addData("f,f,m,xb,s&o,w", new String[]{"表伯祖母"});
        addData("f,f,m,xb,s&l", new String[]{"表叔祖父"});
        addData("f,f,m,xb,s&l,w", new String[]{"表叔祖母"});
        addData("f,f,m,xb,d", new String[]{"表姑祖母"});
        addData("f,f,m,xb,d,h", new String[]{"表姑祖父"});
        addData("f,f,m,xs", new String[]{"姨曾祖母", "太姨奶", "姨太太", "曾姨奶奶", "姨太奶奶", "姨婆奶奶"});
        addData("f,f,m,xs,h", new String[]{"姨曾祖父", "太姨爷", "姨太爷", "姨太爷爷"});
        addData("f,f,m,xs,s&o", new String[]{"表伯祖父"});
        addData("f,f,m,xs,s&o,w", new String[]{"表伯祖母"});
        addData("f,f,m,xs,s&l", new String[]{"表叔祖父"});
        addData("f,f,m,xs,s&l,w", new String[]{"表叔祖母"});
        addData("f,f,m,xs,d", new String[]{"表姑祖母"});
        addData("f,f,m,xs,d,h", new String[]{"表姑祖父"});
        addData("f,f,xb", new String[]{"堂祖父", "x爷爷"});
        addData("f,f,xb,w", new String[]{"堂祖母"});
        addData("f,f,xb,s&o", new String[]{"堂伯", "堂伯父", "从父伯父"});
        addData("f,f,xb,s&o,w", new String[]{"堂伯母", "从父伯母"});
        addData("f,f,xb,s&l", new String[]{"堂叔", "从父叔父"});
        addData("f,f,xb,s,w", new String[]{"堂婶", "堂叔母", "堂婶母", "从父叔母"});
        addData("f,f,xb,s,s&o", new String[]{"从兄", "再从兄", "从兄弟"});
        addData("f,f,xb,s,s&o,w", new String[]{"从嫂", "再从嫂"});
        addData("f,f,xb,s,s&l", new String[]{"从弟", "再从弟", "从兄弟"});
        addData("f,f,xb,s,s&l,w", new String[]{"从弟妹", "再从弟妹", "再从兄"});
        addData("f,f,xb,s,s,s", new String[]{"从侄", "再从侄", "从侄子"});
        addData("f,f,xb,s,s,s,w", new String[]{"从侄媳妇", "再从侄妇"});
        addData("f,f,xb,s,s,s,s", new String[]{"从侄孙"});
        addData("f,f,xb,s,s,s,d", new String[]{"从侄孙女"});
        addData("f,f,xb,s,s,d", new String[]{"从侄女", "再从侄女"});
        addData("f,f,xb,s,s,d,h", new String[]{"从侄女婿", "再从侄女婿", "姻家侄婿"});
        addData("f,f,xb,s,d&o", new String[]{"从姐", "再从姐", "从姐妹"});
        addData("f,f,xb,s,d&o,h", new String[]{"从姐夫", "再从姐夫"});
        addData("f,f,xb,s,d&l", new String[]{"从妹", "再从妹", "从姐妹"});
        addData("f,f,xb,s,d&l,h", new String[]{"从妹夫", "再妹夫"});
        addData("f,f,xb,d", new String[]{"堂姑", "堂姑妈", "堂姑母", "从父姑母"});
        addData("f,f,xb,d,h", new String[]{"堂姑丈", "堂姑爸", "堂姑父", "从父姑父"});
        addData("f,f,xb,d,s&o", new String[]{"堂姑表兄"});
        addData("f,f,xb,d,s&l", new String[]{"堂姑表弟"});
        addData("f,f,xb,d,d&o", new String[]{"堂姑表姐"});
        addData("f,f,xb,d,d&l", new String[]{"堂姑表妹"});
        addData("f,f,ob", new String[]{"伯祖父", "伯老爷", "伯公", "大爷爷", "大爷", "堂祖父", "伯爷爷"});
        addData("f,f,ob,w", new String[]{"伯祖母", "伯奶奶", "伯婆", "大奶奶", "堂祖母", "姆婆"});
        addData("f,f,lb", new String[]{"叔祖父", "叔老爷", "叔公", "小爷爷", "堂祖父", "叔爷爷", "叔奶爷"});
        addData("f,f,lb,w", new String[]{"叔祖母", "叔奶奶", "叔婆", "小奶奶", "堂祖母", "婶婆"});
        addData("f,f,xs", new String[]{"姑奶奶", "姑内祖母", "祖姑母", "姑祖母", "姑奶", "姑婆", "祖姑"});
        addData("f,f,xs,h", new String[]{"姑爷爷", "姑内祖父", "祖姑父", "姑祖父", "姑老爷", "姑公", "姑奶爷", "姑丈公"});
        addData("f,f,xs,s&o", new String[]{"姑表伯父", "表伯父", "表伯"});
        addData("f,f,xs,s&o,w", new String[]{"姑表伯母", "表伯母"});
        addData("f,f,xs,s&l", new String[]{"姑表叔父", "表叔父", "表叔爸", "表叔"});
        addData("f,f,xs,s&l,w", new String[]{"姑表叔母", "表叔母", "表叔妈", "表婶"});
        addData("f,f,xs,s,s", new String[]{"从表兄弟"});
        addData("f,f,xs,s,d", new String[]{"从表姐妹"});
        addData("f,f,xs,d", new String[]{"姑表姑母", "表姑妈", "表姑母", "表姑姑", "表姑"});
        addData("f,f,xs,d,h", new String[]{"姑表姑父", "表姑爸", "表姑父", "表姑丈"});
        addData("f,f,xs,d,s", new String[]{"从表兄弟"});
        addData("f,f,xs,d,d", new String[]{"从表姐妹"});
        addData("f,m", new String[]{"奶奶", "祖母", "阿嫲", "阿嬷", "嫲嫲"});
        addData("f,m,f", new String[]{"曾外祖父", "外太公", "太姥爷"});
        addData("f,m,f,f", new String[]{"曾外曾祖父", "祖太爷", "祖太爷爷", "祖太公"});
        addData("f,m,f,m", new String[]{"曾外曾祖母", "祖太太", "祖太奶奶", "祖太婆"});
        addData("f,m,f,xb,s", new String[]{"堂舅祖父"});
        addData("f,m,f,xb,s,w", new String[]{"堂舅祖母"});
        addData("f,m,f,xb,d", new String[]{"堂姨祖母"});
        addData("f,m,f,xb,d,h", new String[]{"堂姨祖父"});
        addData("f,m,f,ob", new String[]{"伯曾外祖父", "伯太姥爷", "伯太奶爷"});
        addData("f,m,f,ob,w", new String[]{"伯曾外祖母", "伯太姥姥", "伯太奶奶"});
        addData("f,m,f,lb", new String[]{"叔曾外祖父", "叔太姥爷", "叔太奶爷"});
        addData("f,m,f,lb,w", new String[]{"叔曾外祖母", "叔太姥姥", "叔太奶奶"});
        addData("f,m,f,xs", new String[]{"姑曾外祖母", "姑太姥姥", "姑太奶奶"});
        addData("f,m,f,xs,h", new String[]{"姑曾外祖父", "姑太姥爷", "姑太奶爷", "姑太爷爷"});
        addData("f,m,f,xs,s", new String[]{"表舅祖父"});
        addData("f,m,f,xs,s,w", new String[]{"表舅祖母"});
        addData("f,m,m", new String[]{"曾外祖母", "外太婆", "太姥姥"});
        addData("f,m,m,f", new String[]{"曾外曾外祖父", "祖太姥爷", "祖太公"});
        addData("f,m,m,m", new String[]{"曾外曾外祖母", "祖太姥姥", "祖太姥娘", "祖太婆"});
        addData("f,m,m,xb", new String[]{"舅曾外祖父", "舅太姥爷", "舅太奶爷"});
        addData("f,m,m,xb,w", new String[]{"舅曾外祖母", "舅太姥姥", "舅太奶奶"});
        addData("f,m,m,xb,s", new String[]{"表舅祖父"});
        addData("f,m,m,xb,s,w", new String[]{"表舅祖母"});
        addData("f,m,m,xb,d", new String[]{"表姨祖母"});
        addData("f,m,m,xb,d,h", new String[]{"表姨祖父"});
        addData("f,m,m,xs", new String[]{"姨曾外祖母", "姨太姥姥", "姨太奶奶"});
        addData("f,m,m,xs,h", new String[]{"姨曾外祖父", "姨太姥爷", "姨太奶爷"});
        addData("f,m,m,xs,d", new String[]{"表姨祖母"});
        addData("f,m,m,xs,d,h", new String[]{"表姨祖父"});
        addData("f,m,m,xs,s", new String[]{"表舅祖父"});
        addData("f,m,m,xs,s,w", new String[]{"表舅祖母"});
        addData("f,m,m,xs,d", new String[]{"表姨祖母"});
        addData("f,m,m,xs,d,h", new String[]{"表姨祖父"});
        addData("f,m,xb", new String[]{"舅公", "舅祖父", "舅老爷", "舅爷爷", "舅爷", "舅祖", "舅奶爷", "太舅父"});
        addData("f,m,xb,w", new String[]{"舅婆", "舅祖母", "舅奶奶", "舅奶", "妗婆", "太舅母"});
        addData("f,m,xb,s&o", new String[]{"舅表伯父", "表伯父", "表伯"});
        addData("f,m,xb,s&o,w", new String[]{"舅表伯母", "表伯母"});
        addData("f,m,xb,s&l", new String[]{"舅表叔父", "表叔父", "表叔爸", "表叔"});
        addData("f,m,xb,s&l,w", new String[]{"舅表叔母", "表叔母", "表叔妈", "表婶"});
        addData("f,m,xb,s,s", new String[]{"从表兄弟"});
        addData("f,m,xb,s,d", new String[]{"从表姐妹"});
        addData("f,m,xb,d", new String[]{"舅表姑母", "表姑妈", "表姑母", "表姑姑", "表姑"});
        addData("f,m,xb,d,h", new String[]{"舅表姑父", "表姑爸", "表姑父", "表姑丈"});
        addData("f,m,xb,d,s", new String[]{"从表兄弟"});
        addData("f,m,xb,d,d", new String[]{"从表姐妹"});
        addData("f,m,xs", new String[]{"姨奶奶", "祖姨母", "姨祖母", "姨婆", "姨奶"});
        addData("f,m,xs,h", new String[]{"姨爷爷", "祖姨父", "姨祖父", "姨公", "姨丈公", "姨爷", "姨老爷", "姨奶爷"});
        addData("f,m,xs,s&o", new String[]{"姨表伯父", "表伯", "表伯父", "从母伯父"});
        addData("f,m,xs,s&o,w", new String[]{"姨表伯母", "表伯母", "从母伯母"});
        addData("f,m,xs,s&l", new String[]{"姨表叔父", "表叔父", "表叔爸", "表叔", "从母叔父"});
        addData("f,m,xs,s&l,w", new String[]{"姨表叔母", "表叔母", "表叔妈", "表婶", "从母叔母"});
        addData("f,m,xs,s,s", new String[]{"从表兄弟"});
        addData("f,m,xs,s,d", new String[]{"从表姐妹"});
        addData("f,m,xs,d", new String[]{"姨表姑母", "表姑妈", "表姑母", "表姑姑", "表姑", "从母姑母"});
        addData("f,m,xs,d,h", new String[]{"姨表姑父", "表姑爸", "表姑父", "表姑丈", "从母姑父"});
        addData("f,m,xs,d,s", new String[]{"从表兄弟"});
        addData("f,m,xs,d,d", new String[]{"从表姐妹"});
        addData("f,xb,w,f", new String[]{"姻伯公"});
        addData("f,xb,w,m", new String[]{"姻伯婆"});
        addData("f,xb,w,xb", new String[]{"姻世伯"});
        addData("f,xb,w,xb,w", new String[]{"姻伯母"});
        addData("f,xb,w,xs", new String[]{"姻伯母"});
        addData("f,xb,w,xs,h", new String[]{"姻世伯"});
        addData("f,xb,s&o", new String[]{"堂哥", "堂兄", "堂阿哥", "叔伯兄弟"});
        addData("f,xb,s&o,w", new String[]{"堂嫂"});
        addData("f,xb,s&l", new String[]{"堂弟", "堂阿弟", "叔伯兄弟"});
        addData("f,xb,s&l,w", new String[]{"堂弟媳", "堂弟妹"});
        addData("f,xb,s,s", new String[]{"堂侄", "堂侄子", "叔伯侄子"});
        addData("f,xb,s,s,w", new String[]{"堂侄媳妇"});
        addData("f,xb,s,s,s", new String[]{"堂侄孙"});
        addData("f,xb,s,s,s,w", new String[]{"堂侄孙媳妇"});
        addData("f,xb,s,s,d", new String[]{"堂侄孙女"});
        addData("f,xb,s,s,d,h", new String[]{"堂侄孙女婿"});
        addData("f,xb,s,d", new String[]{"堂侄女"});
        addData("f,xb,s,d,h", new String[]{"堂侄女婿", "姻家侄"});
        addData("f,xb,d&o", new String[]{"堂姐", "堂阿姐", "叔伯姐妹"});
        addData("f,xb,d&o,h", new String[]{"堂姐夫"});
        addData("f,xb,d&l", new String[]{"堂妹", "堂阿妹", "叔伯姐妹"});
        addData("f,xb,d&l,h", new String[]{"堂妹夫"});
        addData("f,xb,d,s", new String[]{"堂外甥"});
        addData("f,xb,d,d", new String[]{"堂外甥女"});
        addData("f,ob", new String[]{"伯父", "伯伯", "阿伯", "大伯", "x伯"});
        addData("f,ob,w", new String[]{"伯母", "大娘", "大妈", "x妈"});
        addData("f,lb", new String[]{"叔叔", "叔父", "阿叔", "叔爸", "叔爹", "仲父", "x叔", "叔"});
        addData("f,lb,w", new String[]{"婶婶", "婶母", "阿婶", "家婶", "叔母", "叔妈", "叔娘", "季母", "x婶", "婶"});
        //姑家
        addData("f,xs", new String[]{"姑妈", "姑姑", "姑娘", "大姑妈", "x姑妈", "姑"});
        addData("f,xs,h", new String[]{"姑丈", "姑父", "姑爸", "姑夫"});
        addData("f,xs,h,f", new String[]{"姻伯公"});
        addData("f,xs,h,m", new String[]{"姻伯婆"});
        addData("f,xs,h,xb", new String[]{"姻世伯"});
        addData("f,xs,h,xb,w", new String[]{"姻伯母"});
        addData("f,xs,h,xs", new String[]{"姻伯母"});
        addData("f,xs,h,xs,h", new String[]{"姻世伯"});
        addData("f,xs,s&o", new String[]{"姑表哥", "表哥"});
        addData("f,xs,s&o,w", new String[]{"姑表嫂", "表嫂"});
        addData("f,xs,s&l", new String[]{"姑表弟", "表弟"});
        addData("f,xs,s&l,w", new String[]{"姑表弟媳", "表弟媳", "表弟妹"});
        addData("f,xs,s,s", new String[]{"表侄", "表侄子", "姑表侄男", "表侄男"});
        addData("f,xs,s,s,s", new String[]{"表侄孙"});
        addData("f,xs,s,s,s,w", new String[]{"表侄孙媳妇"});
        addData("f,xs,s,s,d", new String[]{"表侄孙女"});
        addData("f,xs,s,s,d,h", new String[]{"表侄孙女婿"});
        addData("f,xs,s,d", new String[]{"表侄女", "姑表侄女"});
        addData("f,xs,s,d,s", new String[]{"外表侄孙"});
        addData("f,xs,s,d,s,w", new String[]{"外表侄孙媳妇"});
        addData("f,xs,s,d,d", new String[]{"外表侄孙女"});
        addData("f,xs,s,d,d,h", new String[]{"外表侄孙女婿"});
        addData("f,xs,d&o", new String[]{"姑表姐", "表姐"});
        addData("f,xs,d&o,h", new String[]{"姑表姐夫", "表姐夫", "表姐丈"});
        addData("f,xs,d&l", new String[]{"姑表妹", "表妹"});
        addData("f,xs,d&l,h", new String[]{"姑表妹夫", "表妹夫"});
        addData("f,xs,d,s", new String[]{"表外甥", "姑表甥男", "表甥男"});
        addData("f,xs,d,d", new String[]{"表外甥女", "姑表甥女", "表甥女"});
        addData("f,os", new String[]{"姑妈", "姑母"});
        addData("f,ls", new String[]{"姑妈", "姑姐"});
        //外家
        addData("m", new String[]{"妈妈", "母亲", "老妈", "阿妈", "老母", "老妈子", "娘", "妈", "娘亲", "妈咪", "母"});
        addData("m,f", new String[]{"外公", "外祖父", "姥爷"});
        addData("m,f,f", new String[]{"外曾祖父", "外太祖父", "外太公", "外太爷爷", "太外祖父"});
        addData("m,f,f,f", new String[]{"外高祖父", "祖太爷", "祖太爷爷", "祖太公"});
        addData("m,f,f,m", new String[]{"外高祖母", "祖太太", "祖太奶奶", "祖太婆"});
        addData("m,f,f,xb,s&o", new String[]{"堂伯外祖父"});
        addData("m,f,f,xb,s&o,w", new String[]{"堂伯外祖母"});
        addData("m,f,f,xb,s&l", new String[]{"堂叔外祖父"});
        addData("m,f,f,xb,s&l,w", new String[]{"堂叔外祖母"});
        addData("m,f,f,xb,d", new String[]{"堂姑外祖母"});
        addData("m,f,f,xb,d,h", new String[]{"堂姑外祖父"});
        addData("m,f,f,ob", new String[]{"伯外曾祖父", "外太伯公", "伯太姥爷", "伯太奶爷", "伯太爷爷"});
        addData("m,f,f,ob,w", new String[]{"伯外曾祖母", "外太伯母", "伯太姥姥", "伯太奶奶"});
        addData("m,f,f,lb", new String[]{"叔外曾祖父", "外太叔公", "叔太姥爷", "叔太奶爷", "叔太爷爷"});
        addData("m,f,f,lb,w", new String[]{"叔外曾祖母", "外太叔母", "叔太姥姥", "叔太奶奶"});
        addData("m,f,f,xs", new String[]{"姑外曾祖母", "外太姑婆", "姑太姥姥", "姑太奶奶"});
        addData("m,f,f,xs,h", new String[]{"姑外曾祖父", "外太姑丈公", "姑太姥爷", "姑太奶爷", "姑太爷爷"});
        addData("m,f,f,xs,s&o", new String[]{"表伯外祖父", "外表伯祖父"});
        addData("m,f,f,xs,s&o,w", new String[]{"表伯外祖母", "外表伯祖母"});
        addData("m,f,f,xs,s&l", new String[]{"表叔外祖父", "外表叔祖父"});
        addData("m,f,f,xs,s&l,w", new String[]{"表叔外祖母", "外表叔祖母"});
        addData("m,f,f,xs,d", new String[]{"表姑外祖母"});
        addData("m,f,f,xs,d,h", new String[]{"表姑外祖父"});
        addData("m,f,m", new String[]{"外曾祖母", "外太祖母", "太外祖母", "外太奶奶", "外太婆"});
        addData("m,f,m,f", new String[]{"外高外祖父", "祖太姥爷", "祖太公"});
        addData("m,f,m,m", new String[]{"外高外祖母", "祖太姥姥", "祖太姥娘", "祖太婆"});
        addData("m,f,m,xb", new String[]{"舅外曾祖父", "外太舅公", "舅太姥爷", "舅太奶爷"});
        addData("m,f,m,xb,w", new String[]{"舅外曾祖母", "外太舅母", "舅太姥姥", "舅太奶奶", "外太舅婆"});
        addData("m,f,m,xb,s&o", new String[]{"表伯外祖父", "外表伯祖父"});
        addData("m,f,m,xb,s&o,w", new String[]{"表伯外祖母", "外表伯祖母"});
        addData("m,f,m,xb,s&l", new String[]{"表叔外祖父", "外表叔祖父"});
        addData("m,f,m,xb,s&l,w", new String[]{"表叔外祖母", "外表叔祖母"});
        addData("m,f,m,xb,d", new String[]{"表姑外祖母"});
        addData("m,f,m,xb,d,h", new String[]{"表姑外祖父"});
        addData("m,f,m,xs", new String[]{"姨外曾祖母", "外太姨婆", "姨太姥姥", "姨太奶奶"});
        addData("m,f,m,xs,h", new String[]{"姨外曾祖父", "外太姑姨公", "姨太姥爷", "姨太奶爷", "姨太爷爷"});
        addData("m,f,m,xs,s&o", new String[]{"表伯外祖父", "外表伯祖父"});
        addData("m,f,m,xs,s&o,w", new String[]{"表伯外祖母", "外表伯祖母"});
        addData("m,f,m,xs,s&l", new String[]{"表叔外祖父", "外表叔祖父"});
        addData("m,f,m,xs,s&l,w", new String[]{"表叔外祖母", "外表叔祖母"});
        addData("m,f,m,xs,d", new String[]{"表姑外祖母"});
        addData("m,f,m,xs,d,h", new String[]{"表姑外祖父"});
        addData("m,f,xb", new String[]{"大姥爷/小姥爷", "x姥爷"});
        addData("m,f,xb,s", new String[]{"堂舅", "堂舅爸", "堂舅父", "堂舅舅", "从父舅父"});
        addData("m,f,xb,s,w", new String[]{"堂舅妈", "堂舅母", "从父舅母"});
        addData("m,f,xb,s,s&o", new String[]{"堂舅表兄"});
        addData("m,f,xb,s,s&l", new String[]{"堂舅表弟"});
        addData("m,f,xb,s,d&o", new String[]{"堂舅表姐"});
        addData("m,f,xb,s,d&l", new String[]{"堂舅表妹"});
        addData("m,f,xb,d", new String[]{"堂姨", "堂姨妈", "堂姨母", "从父姨母"});
        addData("m,f,xb,d,h", new String[]{"堂姨丈", "堂姨爸", "堂姨父", "从父姨父"});
        addData("m,f,xb,d,s&o", new String[]{"堂姨表兄"});
        addData("m,f,xb,d,s&l", new String[]{"堂姨表弟"});
        addData("m,f,xb,d,d&o", new String[]{"堂姨表姐"});
        addData("m,f,xb,d,d&l", new String[]{"堂姨表妹"});
        addData("m,f,ob", new String[]{"伯外祖父", "外伯祖父", "伯姥爷", "大姥爷", "外伯祖", "外伯公"});
        addData("m,f,ob,w", new String[]{"伯外祖母", "外伯祖母", "伯姥姥", "大姥姥", "外姆婆", "外伯婆"});
        addData("m,f,lb", new String[]{"叔外祖父", "外叔祖父", "叔姥爷", "小姥爷", "外叔祖", "叔外祖", "外叔公"});
        addData("m,f,lb,w", new String[]{"叔外祖母", "外叔祖母", "叔姥姥", "小姥姥", "外姆婆", "外叔婆"});
        addData("m,f,xs", new String[]{"姑姥姥", "姑外祖母", "外姑祖母", "外太姑母", "外姑婆", "外姑母"});
        addData("m,f,xs,h", new String[]{"姑姥爷", "姑外祖父", "外姑祖父", "外太姑父", "外姑公", "外姑丈"});
        addData("m,f,xs,s", new String[]{"姑表舅父", "姑表舅爸", "表舅父", "表舅爸", "表舅", "表舅舅", "姑表舅舅"});
        addData("m,f,xs,s,w", new String[]{"姑表舅母", "姑表舅妈", "表舅母", "表舅妈"});
        addData("m,f,xs,s,s", new String[]{"从表兄弟"});
        addData("m,f,xs,s,d", new String[]{"从表姐妹"});
        addData("m,f,xs,d", new String[]{"姑表姨母", "姑表姨妈", "表姨母", "表姨妈", "表姨", "表阿姨", "姑表姨姨"});
        addData("m,f,xs,d,h", new String[]{"姑表姨父", "姑表姨父", "表姨丈", "表姨父"});
        addData("m,f,xs,d,s", new String[]{"从表兄弟"});
        addData("m,f,xs,d,d", new String[]{"从表姐妹"});
        addData("m,m", new String[]{"外婆", "外祖母", "姥姥", "阿婆"});
        addData("m,m,f", new String[]{"外曾外祖父", "外太外公", "外太姥爷"});
        addData("m,m,f,f", new String[]{"外曾外曾祖父", "祖太爷", "祖太爷爷", "祖太公"});
        addData("m,m,f,m", new String[]{"外曾外曾祖母", "祖太太", "祖太奶奶", "祖太婆"});
        addData("m,m,f,xb,s", new String[]{"堂舅外祖父"});
        addData("m,m,f,xb,s,w", new String[]{"堂舅外祖母"});
        addData("m,m,f,xb,d", new String[]{"堂姨外祖母"});
        addData("m,m,f,xb,d,h", new String[]{"堂姨外祖父"});
        addData("m,m,f,ob", new String[]{"伯外曾外祖父", "伯太姥爷"});
        addData("m,m,f,ob,w", new String[]{"伯外曾外祖母", "伯太姥姥"});
        addData("m,m,f,lb", new String[]{"叔外曾外祖父", "叔太姥爷"});
        addData("m,m,f,lb,w", new String[]{"叔外曾外祖母", "叔太姥姥"});
        addData("m,m,f,xs", new String[]{"姑外曾外祖母", "姑太姥姥"});
        addData("m,m,f,xs,h", new String[]{"姑外曾外祖父", "姑太姥爷"});
        addData("m,m,f,xs,s", new String[]{"表舅外祖父"});
        addData("m,m,f,xs,s,w", new String[]{"表舅外祖母"});
        addData("m,m,f,xs,d", new String[]{"表姨外祖母"});
        addData("m,m,f,xs,d,h", new String[]{"表姨外祖父"});
        addData("m,m,m", new String[]{"外曾外祖母", "外太外婆", "外太姥姥"});
        addData("m,m,m,f", new String[]{"外曾外曾外祖父", "祖太姥爷", "祖太公"});
        addData("m,m,m,m", new String[]{"外曾外曾外祖母", "祖太姥姥", "祖太姥娘", "祖太婆"});
        addData("m,m,m,xb", new String[]{"舅外曾外祖父", "舅太姥爷"});
        addData("m,m,m,xb,w", new String[]{"舅外曾外祖母", "舅太姥姥"});
        addData("m,m,m,xb,s", new String[]{"表舅外祖父"});
        addData("m,m,m,xb,s,w", new String[]{"表舅外祖母"});
        addData("m,m,m,xb,d", new String[]{"表姨外祖母"});
        addData("m,m,m,xb,d,h", new String[]{"表姨外祖父"});
        addData("m,m,m,xs", new String[]{"姨外曾外祖母", "姨太姥姥"});
        addData("m,m,m,xs,h", new String[]{"姨外曾外祖父", "姨太姥爷"});
        addData("m,m,m,xs,s", new String[]{"表舅外祖父"});
        addData("m,m,m,xs,s,w", new String[]{"表舅外祖母"});
        addData("m,m,m,xs,d", new String[]{"表姨外祖母"});
        addData("m,m,m,xs,d,h", new String[]{"表姨外祖父"});
        addData("m,m,xb", new String[]{"外舅公", "外舅祖父", "外太舅父", "舅外祖父", "舅姥爷", "舅外公", "舅公", "x舅姥爷"});
        addData("m,m,xb,w", new String[]{"外舅婆", "外舅祖母", "外太舅母", "舅外祖母", "舅姥姥", "舅婆", "外妗婆"});
        addData("m,m,xb,s", new String[]{"舅表舅父", "舅表舅爸", "表舅父", "表舅爸", "表舅", "表舅舅", "舅表舅舅"});
        addData("m,m,xb,s,w", new String[]{"舅表舅母", "舅表舅妈", "表舅母", "表舅妈"});
        addData("m,m,xb,s,s", new String[]{"从表兄弟"});
        addData("m,m,xb,s,d", new String[]{"从表姐妹"});
        addData("m,m,xb,d", new String[]{"舅表姨母", "舅表姨妈", "表姨母", "表姨妈", "表姨", "表阿姨", "舅表姨姨"});
        addData("m,m,xb,d,h", new String[]{"舅表姨父", "舅表姨丈", "表姨父", "表姨丈"});
        addData("m,m,xb,d,s", new String[]{"从表兄弟"});
        addData("m,m,xb,d,d", new String[]{"从表姐妹"});
        addData("m,m,xs", new String[]{"姨姥姥", "姨外祖母", "外姨婆", "外姨祖母", "姨婆", "姨姥"});
        addData("m,m,xs,h", new String[]{"姨姥爷", "姨外祖父", "外姨丈公", "外姨祖父", "姨公"});
        addData("m,m,xs,s", new String[]{"姨表舅父", "姨表舅爸", "表舅父", "表舅爸", "表舅", "表舅舅", "姨表舅舅", "从母舅父"});
        addData("m,m,xs,s,w", new String[]{"姨表舅母", "姨表舅妈", "表舅母", "表舅妈", "从母舅母"});
        addData("m,m,xs,s,s", new String[]{"从表兄弟"});
        addData("m,m,xs,s,d", new String[]{"从表姐妹"});
        addData("m,m,xs,d", new String[]{"姨表姨母", "姨表姨妈", "表姨母", "表姨妈", "表姨", "表阿姨", "姨表姨姨", "从母姨母"});
        addData("m,m,xs,d,h", new String[]{"姨表姨父", "姨表姨丈", "表姨父", "表姨丈", "从母姨父"});
        addData("m,m,xs,d,s", new String[]{"从表兄弟"});
        addData("m,m,xs,d,d", new String[]{"从表姐妹"});
        //舅家
        addData("m,xb", new String[]{"舅舅", "舅父", "舅", "娘舅", "舅仔", "母舅", "舅爸", "舅爹", "阿舅", "x舅"});
        addData("m,xb,w", new String[]{"舅妈", "舅母", "妗子", "妗妗", "妗母", "阿妗", "x舅妈"});
        addData("m,xb,w,f", new String[]{"姻伯公"});
        addData("m,xb,w,m", new String[]{"姻伯婆"});
        addData("m,xb,w,xb", new String[]{"姻世伯"});
        addData("m,xb,w,xb,w", new String[]{"姻伯母"});
        addData("m,xb,w,xs", new String[]{"姻伯母"});
        addData("m,xb,w,xs,h", new String[]{"姻世伯"});
        addData("m,xb,s&o", new String[]{"舅表哥", "表哥"});
        addData("m,xb,s&o,w", new String[]{"舅表嫂", "表嫂"});
        addData("m,xb,s&l", new String[]{"舅表弟","表弟"});
        addData("m,xb,s&l,w", new String[]{"舅表弟媳", "表弟媳", "表弟妹"});
        addData("m,xb,s,s", new String[]{"表侄", "表侄子", "舅表侄男", "表侄男"});
        addData("m,xb,s,s,s", new String[]{"表侄孙"});
        addData("m,xb,s,s,s,w", new String[]{"表侄孙媳妇"});
        addData("m,xb,s,s,d", new String[]{"表侄孙女"});
        addData("m,xb,s,s,d,h", new String[]{"表侄孙女婿"});
        addData("m,xb,s,d", new String[]{"表侄女", "舅表侄女"});
        addData("m,xb,s,d,s", new String[]{"外表侄孙"});
        addData("m,xb,s,d,s,w", new String[]{"外表侄孙媳妇"});
        addData("m,xb,s,d,d", new String[]{"外表侄孙女"});
        addData("m,xb,s,d,d,h", new String[]{"外表侄孙女婿"});
        addData("m,xb,d&o", new String[]{"舅表姐", "表姐"});
        addData("m,xb,d&o,h", new String[]{"舅表姐夫", "表姐夫", "表姐丈"});
        addData("m,xb,d&l", new String[]{"舅表妹", "表妹"});
        addData("m,xb,d&l,h", new String[]{"舅表妹夫", "表妹夫"});
        addData("m,xb,d,s", new String[]{"表外甥", "舅表甥男", "表甥男"});
        addData("m,xb,d,d", new String[]{"表外甥女", "舅表甥女", "表甥女"});
        addData("m,ob", new String[]{"大舅"});
        addData("m,ob,w", new String[]{"大舅妈"});
        addData("m,lb", new String[]{"小舅", "舅父仔"});
        addData("m,lb,w", new String[]{"小舅妈"});
        //姨家
        addData("m,xs", new String[]{"姨妈", "姨母", "姨姨", "姨娘", "阿姨", "姨", "x姨", "x姨妈"});
        addData("m,xs,h", new String[]{"姨丈", "姨父", "姨爸", "姨爹", "x姨父"});
        addData("m,xs,h,f", new String[]{"姻伯公"});
        addData("m,xs,h,m", new String[]{"姻伯婆"});
        addData("m,xs,h,xb", new String[]{"姻世伯"});
        addData("m,xs,h,xb,w", new String[]{"姻伯母"});
        addData("m,xs,h,xs", new String[]{"姻伯母"});
        addData("m,xs,h,xs,h", new String[]{"姻世伯"});
        addData("m,xs,s&o", new String[]{"姨表哥", "表哥"});
        addData("m,xs,s&o,w", new String[]{"姨表嫂", "表嫂"});
        addData("m,xs,s&l", new String[]{"姨表弟", "表弟"});
        addData("m,xs,s&l,w", new String[]{"姨表弟媳", "表弟媳", "表弟妹"});
        addData("m,xs,s,s", new String[]{"表侄", "表侄子", "姨表侄男", "表侄男"});
        addData("m,xs,s,s,s", new String[]{"表侄孙"});
        addData("m,xs,s,s,s,w", new String[]{"表侄孙媳妇"});
        addData("m,xs,s,s,d", new String[]{"表侄孙女"});
        addData("m,xs,s,s,d,h", new String[]{"表侄孙女婿"});
        addData("m,xs,s,d", new String[]{"表侄女", "姨表侄女"});
        addData("m,xs,s,d,s", new String[]{"外表侄孙"});
        addData("m,xs,s,d,s,w", new String[]{"外表侄孙媳妇"});
        addData("m,xs,s,d,d", new String[]{"外表侄孙女"});
        addData("m,xs,s,d,d,h", new String[]{"外表侄孙女婿"});
        addData("m,xs,d&o", new String[]{"姨表姐", "表姐"});
        addData("m,xs,d&o,h", new String[]{"姨表姐夫", "表姐夫", "表姐丈"});
        addData("m,xs,d&l", new String[]{"姨表妹", "表妹"});
        addData("m,xs,d&l,h", new String[]{"姨表妹夫", "表妹夫"});
        addData("m,xs,d,s", new String[]{"表外甥", "姨表甥男", "姨表甥男"});
        addData("m,xs,d,d", new String[]{"表外甥女", "姨表甥女", "表甥女"});
        addData("m,os", new String[]{"大姨", "大姨妈"});
        addData("m,os,h", new String[]{"大姨父", "大姨丈"});
        addData("m,ls", new String[]{"小姨", "小姨妈", "姨仔"});
        addData("m,ls,h", new String[]{"小姨父", "小姨丈"});
        //婆家
        addData("h", new String[]{"老公", "丈夫", "先生", "官人", "男人", "汉子", "夫", "夫君", "相公", "夫婿", "爱人", "老伴"});
        addData("h,f", new String[]{"公公", "翁亲", "老公公"});
        addData("h,f,f", new String[]{"祖翁"});
        addData("h,f,f,ob", new String[]{"伯祖翁"});
        addData("h,f,f,ob,w", new String[]{"伯祖婆"});
        addData("h,f,f,lb", new String[]{"叔祖翁"});
        addData("h,f,f,lb,w", new String[]{"叔祖婆"});
        addData("h,f,f,f", new String[]{"太公翁"});
        addData("h,f,f,f,ob", new String[]{"太伯翁"});
        addData("h,f,f,f,ob,w", new String[]{"太姆婆"});
        addData("h,f,f,f,lb", new String[]{"太叔翁"});
        addData("h,f,f,f,lb,w", new String[]{"太婶婆"});
        addData("h,f,f,m", new String[]{"太奶亲"});
        addData("h,f,m", new String[]{"祖婆"});
        addData("h,f,ob", new String[]{"伯翁"});
        addData("h,f,ob,w", new String[]{"伯婆"});
        addData("h,f,lb", new String[]{"叔公", "叔翁", "叔祖"});
        addData("h,f,lb,w", new String[]{"叔婆", "婶婆", "婶亲"});
        addData("h,f,xb,s&o", new String[]{"堂大伯", "堂兄", "堂大伯哥"});
        addData("h,f,xb,s&o,w", new String[]{"堂嫂", "堂大伯嫂"});
        addData("h,f,xb,s&l", new String[]{"堂叔仔", "堂弟", "堂小叔弟"});
        addData("h,f,xb,s&l,w", new String[]{"堂小弟", "堂弟妇", "堂小叔弟妇"});
        addData("h,f,xb,s,s", new String[]{"堂夫侄男"});
        addData("h,f,xb,s,d", new String[]{"堂夫侄女"});
        addData("h,f,xb,d&o", new String[]{"堂大姑姐"});
        addData("h,f,xb,d&o,h", new String[]{"堂大姑姐夫"});
        addData("h,f,xb,d&l", new String[]{"堂小姑妹"});
        addData("h,f,xb,d&l,h", new String[]{"堂小姑妹夫"});
        addData("h,f,xb,d,s", new String[]{"堂夫甥男"});
        addData("h,f,xb,d,d", new String[]{"堂夫甥女"});
        addData("h,f,xs", new String[]{"姑婆"});
        addData("h,f,xs,h", new String[]{"姑公"});
        addData("h,f,xs,s&o", new String[]{"姑表大伯子", "表大伯"});
        addData("h,f,xs,s&o,w", new String[]{"姑表大伯嫂", "表大姆"});
        addData("h,f,xs,s&l", new String[]{"姑表小叔弟", "表叔仔"});
        addData("h,f,xs,s&l,w", new String[]{"姑表小叔弟妇"});
        addData("h,f,xs,s,s", new String[]{"姑表夫侄男"});
        addData("h,f,xs,s,d", new String[]{"姑表夫侄女"});
        addData("h,f,xs,d&o", new String[]{"姑表大姑姐", "表大姑"});
        addData("h,f,xs,d&o,h", new String[]{"姑表大姑姐夫"});
        addData("h,f,xs,d&l", new String[]{"姑表小姑妹", "表姑仔"});
        addData("h,f,xs,d&l,h", new String[]{"姑表小姑妹夫"});
        addData("h,f,xs,d,s", new String[]{"姑表夫甥男"});
        addData("h,f,xs,d,d", new String[]{"姑表夫甥女"});
        addData("h,m", new String[]{"婆婆", "婆母", "姑亲", "老婆婆"});
        addData("h,m,xb", new String[]{"舅公"});
        addData("h,m,xb,w", new String[]{"舅婆"});
        addData("h,m,xb,s&o", new String[]{"舅表大伯子", "表大伯"});
        addData("h,m,xb,s&o,w", new String[]{"舅表大伯嫂", "表大姆"});
        addData("h,m,xb,s&l", new String[]{"舅表小叔弟", "表叔仔"});
        addData("h,m,xb,s&l,w", new String[]{"舅表小叔弟妇"});
        addData("h,m,xb,s,s", new String[]{"舅表夫侄男"});
        addData("h,m,xb,s,d", new String[]{"舅表夫侄女"});
        addData("h,m,xb,d&o", new String[]{"舅表大姑姐", "表大姑"});
        addData("h,m,xb,d&o,h", new String[]{"舅表大姑姐夫"});
        addData("h,m,xb,d&l", new String[]{"舅表小姑妹", "表姑仔"});
        addData("h,m,xb,d&l,h", new String[]{"舅表小姑妹夫"});
        addData("h,m,xb,d,s", new String[]{"舅表夫甥男"});
        addData("h,m,xb,d,d", new String[]{"舅表夫甥女"});
        addData("h,m,xs", new String[]{"姨婆"});
        addData("h,m,xs,h", new String[]{"姨公"});
        addData("h,m,xs,s&o", new String[]{"姨表大伯子", "表大伯"});
        addData("h,m,xs,s&o,w", new String[]{"姨表大伯嫂", "表大姆"});
        addData("h,m,xs,s&l", new String[]{"姨表小叔弟", "表叔仔"});
        addData("h,m,xs,s&l,w", new String[]{"姨表小叔弟妇"});
        addData("h,m,xs,s,s", new String[]{"姨表夫侄男"});
        addData("h,m,xs,s,d", new String[]{"姨表夫侄女"});
        addData("h,m,xs,d&o", new String[]{"姨表大姑姐", "表大姑"});
        addData("h,m,xs,d&o,h", new String[]{"姨表大姑姐夫"});
        addData("h,m,xs,d&l", new String[]{"姨表小姑妹", "表姑仔"});
        addData("h,m,xs,d&l,h", new String[]{"姨表小姑妹夫"});
        addData("h,m,xs,d,s", new String[]{"姨表夫甥男"});
        addData("h,m,xs,d,d", new String[]{"姨表夫甥女"});
        addData("h,ob", new String[]{"大伯子", "大伯哥", "大伯兄", "夫兄"});
        addData("h,ob,w", new String[]{"大婶子", "大伯嫂", "大伯妇", "伯娘", "大伯娘", "大嫂", "夫兄嫂", "妯娌"});
        addData("h,lb", new String[]{"小叔子", "小叔弟"});
        addData("h,lb,w", new String[]{"小婶子", "小叔妇", "小叔媳妇", "小叔弟妇", "妯娌"});
        addData("h,xb,s", new String[]{"叔侄", "婆家侄"});
        addData("h,os", new String[]{"大姑子", "大姑", "大娘姑", "大姑姊"});
        addData("h,os,h", new String[]{"大姑夫", "姊丈", "大姑姐夫", "大姑姊夫"});
        addData("h,ls", new String[]{"小姑子", "小姑", "小姑妹", "姑仔"});
        addData("h,ls,h", new String[]{"小姑夫", "小亘子", "小姑妹夫"});
        addData("h,xs,s", new String[]{"姑甥", "婆家甥"});
        //岳家
        addData("w", new String[]{"老婆", "妻子", "太太", "媳妇儿", "媳妇", "夫人", "女人", "婆娘", "妻", "内人", "娘子", "爱人", "老伴"});
        addData("w,f", new String[]{"岳父", "岳丈", "老丈人", "丈人", "泰山", "妻父"});
        addData("w,f,f", new String[]{"太岳父", "祖岳父"});
        addData("w,f,f,f,xb,s,s&o", new String[]{"姻伯丈"});
        addData("w,f,f,f,xb,s,s&o,w", new String[]{"姻伯丈"});
        addData("w,f,f,f,xb,s,s&l", new String[]{"姻叔丈"});
        addData("w,f,f,f,xb,s,s&l,w", new String[]{"姻婶"});
        addData("w,f,f,ob", new String[]{"太伯岳"});
        addData("w,f,f,ob,w", new String[]{"太伯岳母"});
        addData("w,f,f,lb,", new String[]{"太叔岳"});
        addData("w,f,f,lb,w", new String[]{"太叔岳母"});
        addData("w,f,f,xb,s&o", new String[]{"姻伯"});
        addData("w,f,f,xb,s&o,w", new String[]{"姻姆"});
        addData("w,f,f,xb,s&l", new String[]{"姻叔"});
        addData("w,f,f,xb,s&l,w", new String[]{"姻婶"});
        addData("w,f,f,xs", new String[]{"太姑岳母"});
        addData("w,f,f,xs,h", new String[]{"太姑岳父"});
        addData("w,f,m", new String[]{"太岳母", "祖岳母"});
        addData("w,f,m,xb", new String[]{"太舅岳父"});
        addData("w,f,m,xb,w", new String[]{"太舅岳母"});
        addData("w,f,m,xs", new String[]{"太姨岳母"});
        addData("w,f,m,xs,h", new String[]{"太姨岳父"});
        addData("w,f,xb,s&o", new String[]{"堂大舅", "姻家兄"});
        addData("w,f,xb,s&l", new String[]{"堂舅仔", "姻家弟"});
        addData("w,f,xb,d&o", new String[]{"堂大姨"});
        addData("w,f,xb,d&l", new String[]{"堂姨仔"});
        addData("w,f,ob", new String[]{"伯岳", "伯岳父"});
        addData("w,f,ob,w", new String[]{"伯岳母"});
        addData("w,f,lb", new String[]{"叔岳", "叔岳父"});
        addData("w,f,lb,w", new String[]{"叔岳母"});
        addData("w,f,xs", new String[]{"姑岳母"});
        addData("w,f,xs,h", new String[]{"姑岳父"});
        addData("w,f,xs,s&o", new String[]{"表大舅", "表内兄"});
        addData("w,f,xs,s&o,w", new String[]{"表内嫂"});
        addData("w,f,xs,s&l", new String[]{"表舅仔", "表内弟"});
        addData("w,f,xs,s&l,w", new String[]{"表内弟妇"});
        addData("w,f,xs,d&o", new String[]{"表大姨", "表内姐"});
        addData("w,f,xs,d&o,h", new String[]{"表襟兄"});
        addData("w,f,xs,d&l", new String[]{"表姨仔", "表内妹"});
        addData("w,f,xs,d&l,w", new String[]{"表襟弟"});
        addData("w,m", new String[]{"岳母", "丈母娘", "丈母", "泰水"});
        addData("w,m,f", new String[]{"外太岳父"});
        addData("w,m,m", new String[]{"外太岳母"});
        addData("w,m,xb", new String[]{"舅岳父"});
        addData("w,m,xb,w", new String[]{"舅岳母"});
        addData("w,m,xb,s&o", new String[]{"表大舅"});
        addData("w,m,xb,s&l", new String[]{"表舅仔"});
        addData("w,m,xb,d&o", new String[]{"表大姨"});
        addData("w,m,xb,d&l", new String[]{"表姨仔"});
        addData("w,m,xs", new String[]{"姨岳母"});
        addData("w,m,xs,h", new String[]{"姨岳父"});
        addData("w,m,xs,s&o", new String[]{"表大舅"});
        addData("w,m,xs,s&l", new String[]{"表舅仔"});
        addData("w,m,xs,d&o", new String[]{"表大姨"});
        addData("w,m,xs,d&l", new String[]{"表姨仔"});
        addData("w,xb,s", new String[]{"内侄", "妻侄", "舅侄"});
        addData("w,xb,s,w", new String[]{"内侄媳妇"});
        addData("w,xb,s,s", new String[]{"内侄孙"});
        addData("w,xb,s,s,w", new String[]{"内侄孙媳妇"});
        addData("w,xb,s,d", new String[]{"内侄孙女"});
        addData("w,xb,s,d,h", new String[]{"内侄孙女婿"});
        addData("w,xb,d", new String[]{"内侄女", "妻侄女"});
        addData("w,xb,d,h", new String[]{"内侄女婿"});
        addData("w,xb,d,s", new String[]{"外侄孙"});
        addData("w,xb,d,s,w", new String[]{"外侄孙媳妇"});
        addData("w,xb,d,d", new String[]{"外侄孙女"});
        addData("w,xb,d,d,h", new String[]{"外侄孙女婿"});
        addData("w,ob", new String[]{"大舅子", "大舅哥", "大舅兄", "内兄", "妻兄", "妻舅", "舅兄"});
        addData("w,ob,w", new String[]{"舅嫂", "大舅妇", "大舅嫂", "大舅媳妇", "大妗子", "内嫂", "妻兄嫂"});
        addData("w,lb", new String[]{"小舅子", "小舅弟", "内弟", "妻弟", "妻舅", "舅弟"});
        addData("w,lb,w", new String[]{"舅弟媳", "小舅妇", "小舅弟妇", "小舅媳妇", "小妗子", "妻妹夫"});
        addData("w,xs,s", new String[]{"内甥", "姨甥", "妻外甥"});
        addData("w,xs,s,w", new String[]{"姨甥媳妇"});
        addData("w,xs,s,s", new String[]{"姨甥孙"});
        addData("w,xs,s,s,w", new String[]{"姨甥孙媳妇"});
        addData("w,xs,s,d", new String[]{"姨甥孙女"});
        addData("w,xs,s,d,h", new String[]{"姨甥孙女婿"});
        addData("w,xs,d", new String[]{"姨甥女", "妻外甥女"});
        addData("w,xs,d,h", new String[]{"姨甥女婿"});
        addData("w,xs,d,s", new String[]{"姨甥孙"});
        addData("w,xs,d,s,w", new String[]{"姨甥孙媳妇"});
        addData("w,xs,d,d", new String[]{"姨甥孙女"});
        addData("w,xs,d,d,h", new String[]{"姨甥孙女婿"});
        addData("w,os", new String[]{"大姨子", "大姨姐", "大姨姊", "妻姐"});
        addData("w,os,h", new String[]{"大姨夫", "大姨姐夫", "大姨姊夫", "襟兄", "连襟", "姨夫"});
        addData("w,ls", new String[]{"小姨子", "小姨妹", "妻妹", "小妹儿"});
        addData("w,ls,h", new String[]{"小姨夫", "小姨妹夫", "襟弟", "连襟", "姨夫"});
        //旁支
        addData("xb", new String[]{"兄弟"});
        addData("xb,w,f", new String[]{"姻世伯", "亲家爷", "亲爹", "亲伯"});
        addData("xb,w,f,f", new String[]{"姻伯祖/姻叔祖"});
        addData("xb,w,m", new String[]{"姻伯母", "亲家娘", "亲娘"});
        addData("xb,w,xb", new String[]{"姻兄/姻弟"});
        addData("xb,w,xs", new String[]{"姻姐/姻妹"});
        addData("xb,s", new String[]{"侄子", "侄儿", "阿侄"});
        addData("xb,s,w", new String[]{"侄媳", "侄媳妇"});
        addData("xb,s,s", new String[]{"侄孙", "侄孙子"});
        addData("xb,s,s,w", new String[]{"侄孙媳"});
        addData("xb,s,s,s", new String[]{"侄曾孙"});
        addData("xb,s,s,s,w", new String[]{"侄曾孙媳"});
        addData("xb,s,s,d", new String[]{"侄曾孙女"});
        addData("xb,s,s,d,h", new String[]{"侄曾孙女婿"});
        addData("xb,s,d", new String[]{"侄孙女"});
        addData("xb,s,d,h", new String[]{"侄孙女婿", "侄孙婿"});
        addData("xb,d", new String[]{"侄女", "侄囡"});
        addData("xb,d,h", new String[]{"侄女婿", "侄婿"});
        addData("xb,d,s", new String[]{"外侄孙", "外侄孙子", "侄外孙男"});
        addData("xb,d,s,w", new String[]{"外侄孙媳妇"});
        addData("xb,d,d", new String[]{"外侄孙女", "侄外孙女"});
        addData("xb,d,d,h", new String[]{"外侄孙女婿"});
        addData("ob", new String[]{"哥哥", "哥", "兄", "阿哥", "大佬", "老哥", "兄长", "胞哥", "大哥", "x哥"});
        addData("ob,w", new String[]{"嫂子", "嫂", "嫂嫂", "阿嫂", "兄嫂", "大嫂", "x嫂"});
        addData("ob,w,f", new String[]{"姻伯父"});
        addData("ob,w,m", new String[]{"姻伯母"});
        addData("lb", new String[]{"弟弟", "弟", "细佬", "胞弟", "老弟", "x弟"});
        addData("lb,w", new String[]{"弟妹", "弟媳", "弟媳妇", "弟妇", "x弟妹"});
        addData("lb,w,f", new String[]{"姻叔父"});
        addData("lb,w,m", new String[]{"姻叔母"});
        addData("xs", new String[]{"姐妹", "姊妹"});
        addData("xs,h,f", new String[]{"姻世伯", "亲家爷", "亲爹", "亲伯"});
        addData("xs,h,f,f", new String[]{"姻伯祖/姻叔祖"});
        addData("xs,h,m", new String[]{"姻伯母", "亲家娘", "亲娘"});
        addData("xs,h,xb", new String[]{"姻兄/姻弟"});
        addData("xs,h,xs", new String[]{"姻姐/姻妹"});
        addData("xs,s", new String[]{"外甥", "甥男", "甥儿", "甥子", "外甥儿", "外甥子", "外甥儿子"});
        addData("xs,s,w", new String[]{"外甥媳妇"});
        addData("xs,s,s", new String[]{"外甥孙", "甥孙男", "甥孙"});
        addData("xs,s,s,w", new String[]{"外甥孙媳妇"});
        addData("xs,s,s,s", new String[]{"外曾甥孙"});
        addData("xs,s,s,d", new String[]{"外曾甥孙女"});
        addData("xs,s,d", new String[]{"外甥孙女", "甥孙女", "甥孙"});
        addData("xs,s,d,h", new String[]{"外甥孙女婿"});
        addData("xs,s,d,s", new String[]{"外曾甥孙"});
        addData("xs,s,d,d", new String[]{"外曾甥孙女"});
        addData("xs,d", new String[]{"外甥女", "外甥囡"});
        addData("xs,d,h", new String[]{"外甥女婿"});
        addData("xs,d,s", new String[]{"外甥孙", "甥孙男", "甥孙", "甥外孙男", "外弥甥"});
        addData("xs,d,s,w", new String[]{"外甥孙媳妇"});
        addData("xs,d,s,s", new String[]{"外曾甥孙"});
        addData("xs,d,s,d", new String[]{"外曾甥孙女"});
        addData("xs,d,d", new String[]{"外甥孙女", "甥孙女", "甥孙", "甥外孙女", "外弥甥女"});
        addData("xs,d,d,h", new String[]{"外甥孙女婿"});
        addData("xs,d,d,s", new String[]{"外曾甥孙"});
        addData("xs,d,d,d", new String[]{"外曾甥孙女"});
        addData("os", new String[]{"姐姐", "姐", "家姐", "阿姐", "阿姊", "胞姐", "大姐", "x姐"});
        addData("os,h", new String[]{"姐夫", "姊夫", "姊丈", "姊婿", "大姐夫", "x姐夫"});
        addData("ls", new String[]{"妹妹", "妹", "胞妹", "老妹", "x妹"});
        addData("ls,h", new String[]{"妹夫", "妹丈", "妹婿", "x妹夫"});
        //自家
        addData("s", new String[]{"儿子", "仔", "阿仔", "仔仔", "x儿子", "孩子", "孩儿", "儿", "子"});
        addData("s,w", new String[]{"儿媳妇", "儿媳", "新妇"});
        addData("s,w,xb", new String[]{"姻侄"});
        addData("s,w,xb,s", new String[]{"姻侄孙"});
        addData("s,w,xb,d", new String[]{"姻侄孙女"});
        addData("s,w,xs", new String[]{"姻侄女"});
        addData("s,w,xs,s", new String[]{"姻侄孙"});
        addData("s,w,xs,d", new String[]{"姻侄孙女"});
        addData("s,s", new String[]{"孙子", "孙儿", "x孙子", "孙"});
        addData("s,s,w", new String[]{"孙媳妇", "孙媳"});
        addData("s,s,w,xb", new String[]{"姻家再侄"});
        addData("s,s,w,xs", new String[]{"姻家再侄"});
        addData("s,s,s", new String[]{"曾孙"});
        addData("s,s,s,w", new String[]{"曾孙媳妇"});
        addData("s,s,s,s", new String[]{"玄孙", "元孙", "膀孙"});
        addData("s,s,s,d", new String[]{"玄孙女"});
        addData("s,s,s,s,s", new String[]{"来孙"});
        addData("s,s,s,s,d", new String[]{"来孙女"});
        addData("s,s,s,s,s,s", new String[]{"晜孙"});
        addData("s,s,s,s,s,d", new String[]{"晜孙女"});
        addData("s,s,s,s,s,s,s", new String[]{"仍孙"});
        addData("s,s,s,s,s,s,d", new String[]{"仍孙女"});
        addData("s,s,s,s,s,s,s,s", new String[]{"云孙"});
        addData("s,s,s,s,s,s,s,d", new String[]{"云孙女"});
        addData("s,s,s,s,s,s,s,s,s", new String[]{"耳孙"});
        addData("s,s,s,s,s,s,s,s,d", new String[]{"耳孙女"});
        addData("s,s,d", new String[]{"曾孙女"});
        addData("s,s,d,h", new String[]{"曾孙女婿"});
        addData("s,s,d,s", new String[]{"外玄孙"});
        addData("s,s,d,d", new String[]{"外玄孙女"});
        addData("s,d", new String[]{"孙女", "孙囡"});
        addData("s,d,h", new String[]{"孙女婿", "孙婿"});
        addData("s,d,h,xb", new String[]{"姻家再侄"});
        addData("s,d,h,xs", new String[]{"姻家再侄"});
        addData("s,d,s", new String[]{"曾外孙"});
        addData("s,d,d", new String[]{"曾外孙女"});
        addData("d", new String[]{"女儿", "千金", "闺女", "女", "阿女", "女女", "掌上明珠", "乖囡", "囡囡", "姑娘", "x女儿", "孩子", "孩儿"});
        addData("d,h", new String[]{"女婿", "姑爷", "女婿子", "女婿儿", "儿婿"});
        addData("d,h,xb", new String[]{"姻侄"});
        addData("d,h,xb,w", new String[]{"姻侄妇"});
        addData("d,h,xb,s", new String[]{"姻侄孙"});
        addData("d,h,xb,d", new String[]{"姻侄孙女"});
        addData("d,h,xs", new String[]{"姻侄女"});
        addData("d,h,xs,w", new String[]{"姻侄女婿"});
        addData("d,h,xs,s", new String[]{"姻侄孙"});
        addData("d,h,xs,d", new String[]{"姻侄孙女"});
        addData("d,s", new String[]{"外孙"});
        addData("d,s,w", new String[]{"外孙媳"});
        addData("d,s,s", new String[]{"外曾孙", "重外孙"});
        addData("d,s,d", new String[]{"外曾孙女", "重外孙女"});
        addData("d,d", new String[]{"外孙女", "外孙囡"});
        addData("d,d,h", new String[]{"外孙女婿"});
        addData("d,d,s", new String[]{"外曾外孙"});
        addData("d,d,d", new String[]{"外曾外孙女"});
        //亲家
        addData("s,w,m", new String[]{"亲家母", "亲家"});
        addData("s,w,f", new String[]{"亲家公", "亲家翁", "亲家"});
        addData("s,w,f,f", new String[]{"太姻翁"});
        addData("s,w,f,m", new String[]{"太姻姆"});
        addData("s,w,f,ob", new String[]{"姻兄", "姻亲"});
        addData("s,w,f,lb", new String[]{"姻弟", "姻亲"});
        addData("s,w,f,os", new String[]{"姻姐", "姻亲"});
        addData("s,w,f,ls", new String[]{"姻妹", "姻亲"});
        addData("d,h,m", new String[]{"亲家母", "亲家"});
        addData("d,h,f", new String[]{"亲家公", "亲家翁", "亲家"});
        addData("d,h,f,f", new String[]{"太姻翁"});
        addData("d,h,f,m", new String[]{"太姻姆"});
        addData("d,h,f,ob", new String[]{"姻兄", "姻亲"});
        addData("d,h,f,lb", new String[]{"姻弟", "姻亲"});
        addData("s,w,f,os", new String[]{"姻姐", "姻亲"});
        addData("s,w,f,ls", new String[]{"姻妹", "姻亲"});
        //其他
        addData("t", new String[]{"老师", "师父", "师"});
        addData("t,w", new String[]{"师娘", "师母"});
        addData("t,t", new String[]{"师祖", "师公", "师爷", "太师父"});
        addData("t,t,t", new String[]{"太师祖"});
    }


    public void initFilter() {
        this._filter = new JSONArray();

        /* 表亲 */
        //表亲的关系
        addFilter("/^(.+)&o([^#]+)&l/g", "$1$2");
        //表亲的关系
        addFilter("/^(.+)&l([^#]+)&o/g", "$1$2");
        //表亲的关系
        addFilter("/(,[ds],(.+),[ds])&[ol]/g", "$1");
        /* 兄弟姐妹 */
        //哥哥姐姐的哥哥姐姐还是自己的哥哥姐姐(年龄判断)
        addFilter("/(,o[sb])+(,o[sb])/", "$2");
        //弟弟妹妹的弟弟妹妹还是自己的弟弟妹妹(年龄判断)
        addFilter("/(,l[sb])+(,l[sb])/", "$2");
        //如果自己是男性,兄弟姐妹的兄弟就是自己的兄弟或自己
        addFilter("/^(.*)(,[fh1])(,[olx][sb])+,[olx]b(.*)$/", "$1$2,xb$4#$1$2$4");
        //如果自己是女性,兄弟姐妹的姐妹就是自己的姐妹或自己
        addFilter("/^(.*)(,[mw0])(,[olx][sb])+,[olx]s(.*)$/", "$1$2,xs$4#$1$2$4");
        //如果自己是男性,兄弟姐妹的姐妹就是自己的姐妹
        addFilter("/(,[fh1])(,[olx][sb])+,[olx]s/g", "$1,xs");
        //如果自己是女性,兄弟姐妹的兄弟就是自己的兄弟
        addFilter("/(,[mw0])(,[olx][sb])+,[olx]b/g", "$1,xb");
        //不知道性别，兄弟姐妹的兄弟是自己或兄弟
        addFilter("/^,[olx][sb],[olx]b(.+)?$/", "$1#,xb$1");
        //不知道性别，兄弟姐妹的姐妹是自己或姐妹
        addFilter("/^,[olx][sb],[olx]s(.+)?$/", "$1#,xs$1");
        //将复合称谓拆分
        addFilter("/^,x([sb])$/", ",o$1#,l$1");
        /* 父母 */
        //母亲的丈夫是自己的父亲
        addFilter("/m,h/g", "f");
        //父亲的妻子是自己的母亲
        addFilter("/f,w/g", "m");
        //兄弟的父母就是自己的父母
        addFilter("/,[xol][sb](,[mf])/g", "$1");
        /* 父母的子女 */
        //父母的女儿年龄判断是姐姐还是妹妹
        addFilter("/,[mf],d&([ol])/", ",$1s");
        //父母的儿子年龄判断是哥哥还是弟弟
        addFilter("/,[mf],s&([ol])/", ",$1b");
        //如果自己是男性,父母的儿子是自己或者兄弟
        addFilter("/^(.*)(,[fh1]|[xol]b),[mf],s(.*)$/", "$1$2,xb$3#$1$2$3");
        //如果自己是女性,父母的女儿是自己或者姐妹
        addFilter("/^(.*)(,[mw0]|[xol]s),[mf],d(.*)$/", "$1$2,xs$3#$1$2$3");
        //如果自己是女性,父母的儿子是自己兄弟
        addFilter("/(,[mw0]|[xol]s),[mf],s/", "$1,xb");
        //如果自己是男性,父母的女儿是自己姐妹
        addFilter("/(,[fh1]|[xol]b),[mf],d/", "$1,xs");
        //父母的儿子是自己或兄弟
        addFilter("/^,[mf],s(.+)?$/", ",1$1#,xb$1");
        //父母的女儿是自己或者姐妹
        addFilter("/^,[mf],d(.+)?$/", ",0$1#,xs$1");
        /* 孩子 */
        //孩子的姐妹是自己的女儿(年龄判断)
        addFilter("/,[ds]&o,ob/g", ",s&o");
        //孩子的姐妹是自己的女儿(年龄判断)
        addFilter("/,[ds]&o,os/g", ",d&o");
        //孩子的兄弟是自己的儿子(年龄判断)
        addFilter("/,[ds]&l,lb/g", ",s&l");
        //孩子的兄弟是自己的儿子(年龄判断)
        addFilter("/,[ds]&l,ls/g", ",d&l");
        //孩子的姐妹是自己的女儿
        addFilter("/,[ds](&[ol])?,[olx]s/g", ",d");
        //孩子的兄弟是自己的儿子
        addFilter("/,[ds](&[ol])?,[olx]b/g", ",s");
        /* 夫妻 */
        //自己是女性，女儿或儿子的妈妈是自己
        addFilter("/(,[mwd0](&[ol])?|[olx]s),[ds](&[ol])?,m/g", "$1");
        //自己是女性，女儿或儿子的爸爸是自己的丈夫
        addFilter("/(,[mwd0](&[ol])?|[olx]s),[ds](&[ol])?,f/g", "$1,h");
        //自己是男性，女儿或儿子的爸爸是自己
        addFilter("/(,[fhs1](&[ol])?|[olx]b),[ds](&[ol])?,f/g", "$1");
        //自己是男性，女儿或儿子的妈妈是自己的妻子
        addFilter("/(,[fhs1](&[ol])?|[olx]b),[ds](&[ol])?,m/g", "$1,w");
        //不知道性别，子女的妈妈是自己或妻子
        addFilter("/^,[ds],m(.+)?$/", "$1#,w$1");
        //不知道性别，子女的爸爸是自己或丈夫
        addFilter("/^,[ds],f(.+)?$/", "$1#,h$1");
        //夫妻的孩子就是自己的孩子
        addFilter("/,[wh](,[ds])/g", "$1");
        //夫妻的对方是自己
        addFilter("/,w,h|,h,w/g", "");
        //并列关系处理
        addFilter("/(.+)?\\[(.+)\\|(.+)\\](.+)?/g", "$1$2$4#$1$3$4");
    }

    private void addFilter(String exp, String str) {
        JSONObject x = new JSONObject();
        x.put("exp", exp);
        x.put("str", str);
        this._filter.add(x);
    }


    public TRRelationShip() {
        try {
//            this._data = JSON.parseObject(sData);
            initData();
            initFilter();
//            this._data = new JSONObject();
//
////            this._filter = JSON.parseArray(sFilter);
//            this._filter = new JSONArray();
//            JSONObject x = new JSONObject();
//            x.put("exp", "/^(.+)&o([^#]+)&l/g");
//            x.put("str", "$1$2");
//            this._filter.add(x);

        } catch (JSONException e) {
            LOG.jLogd("_filter = %s", this._filter.toJSONString());
            LOG.jLogd("_data = %s", this._data.toJSONString());
        }
    }

    //数组去重
    ArrayList unique(ArrayList<String> arr) {
        ArrayList result = new ArrayList();
        HashMap<String, Boolean> hash = new HashMap<>();
        String item;
        for (int i = 0; i < arr.size(); i++) {
            item = arr.get(i);
            String temp = HUtils.replace(HUtils.replace(item, "/[ol](?=s|b)/", "x"), "/&[ol]/", ""); //对特殊语法标识相互包含的行为去重
            if (!hash.containsKey(item) && !hash.containsKey(temp)) {//hash.get(item) != null && !hash.get(item) && hash.get(temp) != null && !hash.get(temp)) {
                result.add(item);
                hash.put(item, true);
            }
        }
        return result;
    }


    //分词解析
    ArrayList<String> getSelectors(String str) {
        str = HUtils.replace(str, "/[二|三|四|五|六|七|八|九|十]{1,2}/g", "x");
        String[] alists = HUtils.replace(HUtils.replace(HUtils.replace(str, "我", ""), "家的", "的"), "家", "的").split("的");
        ArrayList<String> lists = new ArrayList();
        for (int i = 0; i < alists.length; i++) {
            lists.add(alists[i]);
        }

        ArrayList<String> result = new ArrayList();                        //所有可能性
        boolean match = true;
        Iterator<String> iter = lists.iterator();
        while (iter.hasNext()) {
            String name = iter.next();            //当前匹配词
            ArrayList<String> arr = new ArrayList();                         //当前匹配词可能性
            boolean has = false;
            for (String i : _data.keySet()) {
                JSONArray value = _data.getJSONArray(i);
                if (value.indexOf(name) > -1) {        //是否存在该关系
                    if (!i.isEmpty() || lists.isEmpty()) {        //对‘我’的优化
                        arr.add(i);
                    }
                    has = true;
                }
            }
            if (!has) {
                match = false;
            }
            if (!result.isEmpty()) {                    //当前匹配词与之前可能性组合
                ArrayList<String> res = new ArrayList<>();
                for (int i = 0; i < result.size(); i++) {
                    for (int j = 0; j < arr.size(); j++) {
                        res.add(result.get(i) + "," + arr.get(j));
                    }
                }
                result = res;
            } else {
                for (int i = 0; i < arr.size(); i++) {
                    result.add("," + arr.get(i));
                }
            }
        }
        return match ? result : new ArrayList();
    }

    //简化选择器
    ArrayList selector2id(String selector, int sex) {
        ArrayList result = new ArrayList();
        HashMap hash = new HashMap();
        if (sex < 0) {    //如果自己的性别不确定
            if (selector.indexOf(",w") == 0) {
                sex = 1;
            } else if (selector.indexOf(",h") == 0) {
                sex = 0;
            }
        }
        if (sex > -1) {
            selector = "," + sex + selector;
        }
//        if (selector.match( /,[w0],w |,[h1],h /)){    //同志关系去除
//            return false;
//        }
        getId(result, hash, selector);
        return unique(result);
    }


    //获取数据
    ArrayList getDataById(String id) {
        ArrayList items = new ArrayList();
        String filter = "/&[olx]/g";  //忽略属性

        if (_data.containsKey(id)) {  //直接匹配称呼
            items.addAll(_data.getJSONArray(id));
        } else {
            items = getData(id, filter);
            if (items.isEmpty()) {  //忽略年龄条件查找
                id = HUtils.replace(id, "/&[ol]/g", "");
                items = getData(id, filter);
            }
            if (items.isEmpty()) {  //忽略年龄条件查找
                id = HUtils.replace(id, "/[ol]/g", "x");
                items = getData(id, filter);
            }
            if (items.isEmpty()) {  //缩小访问查找
                String l = HUtils.replace(id, "/x/g", "l");
                items = getData(l, filter);
                String o = HUtils.replace(id, "/x/g", "o");
                items.addAll(getData(o, filter));
            }
        }
        return items;
    }

    ArrayList getData(String d, String filter) {
        ArrayList res = new ArrayList();
        for (String i : _data.keySet()) {
            if (HUtils.replace(i, filter, "").equals(d)) {
                res.add(_data.getJSONArray(i).get(0));
            }
        }
        return res;
    }

    JSONObject addToJson(JSONObject h, String a, String[] b) {
        JSONArray arr = new JSONArray();
        for (int i = 0; i < b.length; i++) {
            arr.add(b[i]);
        }
        h.put(a, b);
        return h;
    }

    //逆转ID
    String reverseId(String id, int sex) {

        JSONObject hash = new JSONObject();//= JSON.parseObject(

        addToJson(hash, "f", new String[]{"d", "s"});
        addToJson(hash, "m", new String[]{"d", "s"});
        addToJson(hash, "h", new String[]{"w", ""});
        addToJson(hash, "w", new String[]{"", "h"});
        addToJson(hash, "s", new String[]{"m", "f"});
        addToJson(hash, "d", new String[]{"m", "f"});
        addToJson(hash, "lb", new String[]{"os", "ob"});
        addToJson(hash, "ob", new String[]{"ls", "lb"});
        addToJson(hash, "xb", new String[]{"xs", "xb"});
        addToJson(hash, "ls", new String[]{"os", "ob"});
        addToJson(hash, "os", new String[]{"ls", "lb"});
        addToJson(hash, "xs", new String[]{"xs", "xb"});

        String age = "";
        if (id.indexOf("&o") > -1) {
            age = "&l";
        } else if (id.indexOf("&l") > -1) {
            age = "&o";
        }
        if (!id.isEmpty()) {
            id = HUtils.replace(id, "/&[ol]/g", "");
            sex = sex != 0 ? 1 : 0;        //逆转运算自身性别必须确定
            String sid = HUtils.replace(HUtils.replace(("," + sex + "," + id)
                    , "/,[fhs]|,[olx]b/g", ",1")
                    , "/,[mwd]|,[olx]s/g", ",0");
            sid = sid.substring(0, sid.lastIndexOf(","));
            String[] id_arr = HUtils.reverse(id.split(","));
            String[] sid_arr = HUtils.reverse(sid.split(","));
            ArrayList arr = new ArrayList();
            for (int i = 0; i < id_arr.length; i++) {
                int idx = 0;
                if(Character.isDigit(sid_arr[i].charAt(0))){
                    idx = Integer.parseInt(sid_arr[i]);
                }else{
                    LOG.jLoge("Error: (%s) should be digit", sid_arr[i]);
                }
                arr.add(hash.getJSONArray(id_arr[i]).getString(idx));
            }
            return HUtils.join(arr, ",") + age;
        }
        return "";
    }

    public ArrayList convert(String text, int sex, String type, boolean reverse) {
        JSONObject options = new JSONObject();
        options.put("text", text);
        options.put("sex", sex);
        options.put("type", type);        //为'chain'时,reverse无效);
        options.put("reverse", reverse);
        return convert(options);
    }

    public ArrayList convert(String text, int sex, boolean reverse) {
        JSONObject options = new JSONObject();
        options.put("text", text);
        options.put("sex", sex);
        options.put("reverse", reverse);
        return convert(options);
    }

    public ArrayList convert(JSONObject parameter) {
        JSONObject options = new JSONObject();
        options.put("text", "");
        options.put("sex", -1);
        options.put("type", "default");        //为'chain'时,reverse无效);
        options.put("reverse", false);

        for (String p : parameter.keySet()) {
            options.put(p, parameter.getString(p));
        }
        ArrayList<String> selectors = getSelectors(options.getString("text"));
        // console.log('selectors#',selectors);
        ArrayList result = new ArrayList();                            //匹配结果
        for (int i = 0; i < selectors.size(); i++) {        //遍历所有可能性
            ArrayList<String> ids = selector2id(selectors.get(i), options.getInteger("sex"));
            // console.log("ids#",ids);
            for (int j = 0; j < ids.size(); j++) {
                String id = ids.get(j);
                if (options.getString("type").equals("chain")) {
                    String item = getChainById(id);
                    if (!item.isEmpty()) {
                        result.add(item);
                    }
                } else {
                    if (options.getBoolean("reverse")) {
                        id = reverseId(id, options.getInteger("sex"));
                    }
                    ArrayList items = getDataById(id);
                    if (!items.isEmpty()) {
                        result.addAll(items);
                    } else if (id.indexOf("w") == 0 || id.indexOf("h") == 0) {  //找不到关系，随爱人叫
                        items = getDataById(id.substring(2));
                        if (!items.isEmpty()) {
                            result.addAll(items);
                        }
                    }
                }
            }
        }
        return unique(result);
    }


    boolean getId(ArrayList result, HashMap<String, Boolean> hash, String selector) {
        String s = "";
        if (!hash.containsKey(selector)) {
            hash.put(selector, true);
            boolean status = true;
            do {
                s = selector;
                Iterator<Object> i = _filter.iterator();
                while (i.hasNext()) {
                    JSONObject item = (JSONObject) i.next();
                    // console.log("filter#",item["exp"],selector);
                    selector = HUtils.replace(selector, item.getString("exp"), item.getString("str"));
                    if (selector.indexOf("#") > -1) {
                        String[] arr = selector.split("#");
                        for (int j = 0; j < arr.length; j++) {
                            getId(result, hash, arr[j]);
                        }
                        status = false;
                        break;
                    }
                }
            } while (!s.equals(selector));
            if (status) {
                if (Pattern.compile("/,[w0],w |,[h1],h /").matcher(selector).matches()) {    //同志关系去除
                    return false;
                }
                selector = HUtils.replace(selector, "/,[01]/", "");
                if(selector.length()>0){
                    selector = selector.substring(1);   //去前面逗号和性别信息
                }
                result.add(selector);
            }
        }
        return true;
    }

    //获取关系链条
    String getChainById(String id) {
        String[] arr = id.split(",");
        ArrayList items = new ArrayList();
        for (int i = 0; i < arr.length; i++) {
            String key = HUtils.replace(arr[i], "/&[ol]/", "");
            items.add(_data.getString(key).charAt(0));
        }
        return HUtils.join(items, "的");
    }


    static class HUtils {
        public static String[] reverse(String[] split) {

            String[] res = new String[split.length];
            for (int i = 0; i < split.length; i++) {
                int x = split.length - 1 - i;
                res[x] = split[i];
            }
            return res;
        }

        public static String join(ArrayList arr, String s) {
            StringBuilder res = new StringBuilder();
            for (int i = 0; i < arr.size(); i++) {
                if (i != 0) {
                    res.append(",");
                }
                res.append(arr.get(i));
            }
            return res.toString();
        }

        public static String replace(String str, String regex, String replacement) {
            String res = "";
            boolean isGlobal = false;
            if (regex.startsWith("/")) {
                regex = regex.substring(1);
            }
            if (regex.endsWith("/g")) {
                isGlobal = true;
                regex = regex.substring(0, regex.length() - 2);
            }else if(regex.endsWith("/")){
                regex = regex.substring(0, regex.length() - 1);
            }
            if (isGlobal) {
                res = str.replaceAll(regex, replacement);
            } else {
                res = str.replaceFirst(regex, replacement);
            }
            res = res.replace("null","");
            return res;
        }
    }
}
